package club.monkeywood.dataobject;

import lombok.*;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.util.Date;

//spring命名规范：实体类名用驼峰，数据库表名用下划线
//否则用@Table(name="表名")注解
@Entity
@DynamicUpdate  //自动更新时间
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(of = "id")
public class Production {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)   //mysql自增一生成id，save时，不用生成key
    private Integer id;

    //名字
    private String name;

    //单价
    private BigDecimal price;

    //单价
    private BigDecimal oldPrice;

    //描述
    private String description;

    //銷售量
    private Integer sellCount;

    //好評率
    private Double rating;

    //詳情
    private String info;

    //库存
    private Integer stock;

    //小图
    private String icon;

    //大图
    private String image;

    //状态,0正常，1下架
    private Integer status;

    //类目ID
    private Integer categoryId;

    private Integer sellerId;

    private Date createTime;

    private Date updateTime;
}
